package com.micro.frog.job.client.feign;

import com.micro.frog.core.common.PageResult;
import com.micro.frog.core.common.Result;
import com.micro.frog.job.model.dto.JobDTO;
import com.micro.frog.job.model.entity.Job;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;


/**
 * 任务实现类
 *
 * @author :  ljh
 * @date : 2018/5/10
 **/
@FeignClient(name = "micro-Job")
public interface JobFeignService {
    /**
     * 所有的任务
     *
     * @return
     */
    @GetMapping(value = "/rbac/job/all")
    Result all();

    /**
     * 所有的任务 分页
     *
     * @return
     */
    @PostMapping(value = "/rbac/job/list")
    PageResult list(JobDTO jobDTO);

    /**
     * 添加任务
     *
     * @param Job
     * @return
     */
    @PostMapping("/rbac/job/add")
    Result add(Job Job);

    /**
     * 删除任务
     *
     * @param id
     * @return
     */
    @PostMapping("/rbac/job/delete")
    Result deleteDict(Integer id);

    /**
     * 更新任务
     *
     * @param Job
     * @return
     */
    @PostMapping("/rbac/job/update")
    Result update(Job Job);

    /**
     * 启动任务
     *
     * @param JobIds
     * @return
     */
    @PostMapping("/rbac/job/run")
    Result triggerSchedule(@RequestParam("JobIds[]") Integer[] JobIds, String userName);
}
